package no.hio.wsprovider.services;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

import no.hio.wsprovider.vo.Product;

/**
 * WebService interface.
 * @author andreas
 * @version 1.0
 * @see Product
 */
@WebService(name="ProductService", targetNamespace="http://hio.no/wsproviderproduct")
public interface ProductService {
	/**
	 * Webmethod for returning all products in database
	 * @return all products.
	 */
	@WebMethod(operationName="findAllProducts")
	@WebResult(name="productList")
	public List<Product> findAllProducts();
	
	
	/**
	 * Returns a specific product based on productID
	 * @param productID
	 * @return Product with given ID, null if non-existent.
	 */
	@WebMethod(operationName="findByProductID")
	@WebResult(name="product")
	public Product findByProductID(@WebParam(name="productID") int productID);
	
	
	/**
	 * Adds a product to database
	 * @param product Product to be added
	 * @return Product ID
	 */
	@WebMethod(operationName="insertProduct")
	@WebResult(name="productID")
	public int insertProduct(@WebParam(name="product") Product product);
	
	/**
	 * Updates existing product to database, uniqueness of product
	 * is based on productID
	 * @param product Product to be updated
	 */
	@WebMethod(operationName="updateProduct")
	public void updateProduct(@WebParam(name="product") Product product);
	
	/**
	 * Delete existing product from database, uniqueness of product
	 * is based on productID
	 * @param product Product to be deleted
	 */
	@WebMethod(operationName="removeProduct")
	public void removeProduct(@WebParam(name="product") Product product);
}
